<?php

namespace app\home\controller;

use app\company\service\DataService;
use library\Controller;
use think\Db;

/**
 * 仓库物资管理
 * Class User
 * @package app\worker\controller
 */
class WhSupplies extends Controller
{

    /**
     * 绑定当前数据表
     * @var string
     */
    protected $table = 'WareHouse';

    /**
     * 仓库物资管理
     * @auth true
     * @menu true
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    public function index()
    {
        $this->title = '仓库物资管理';
        $query = $this->_query($this->table)
        ->alias('wh')
        ->join('platform p', 'p.id = wh.platform_id', 'left')
        ->field('wh.*,p.name as platform_name')
        ->dateBetween('wh.create_at#create_at')
        ->where(['wh.is_deleted' => '0', 'wh.status' => 1]);
        if(session('user.ware_house_id')){
            $query->where('wh.id', session('user.ware_house_id')); 
        }
        $query->like('wh.name#name')
        ->equal('wh.status#status')
        ->order('wh.sort desc, wh.create_at desc')
        ->page();
    }

    protected function _index_page_filter(&$data)
    {

    }

    /**
     * 商品列表
     * @auth true
     */
    public function wh_product()
    {}

    /**
     * 采购订单
     * @auth true
     */
    public function wh_purchase()
    {}

    /**
     * 物资盘点
     * @auth true
     */
    public function wh_inventory()
    {}

}
